import 'package:flutter_test/flutter_test.dart';
import 'package:event_listener/event_listener.dart';
import 'package:event_listener/event_listener_platform_interface.dart';
import 'package:event_listener/event_listener_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockEventListenerPlatform
    with MockPlatformInterfaceMixin
    implements EventListenerPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');
}

void main() {
  final EventListenerPlatform initialPlatform = EventListenerPlatform.instance;

  test('$MethodChannelEventListener is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelEventListener>());
  });

  test('getPlatformVersion', () async {
    EventListener eventListenerPlugin = EventListener();
    MockEventListenerPlatform fakePlatform = MockEventListenerPlatform();
    EventListenerPlatform.instance = fakePlatform;

    expect(await eventListenerPlugin.getPlatformVersion(), '42');
  });
}
